public class MyDate {

    //默认的初始值  就地初始化  定义的同时初始化
    public int year;
    //year = 100;  error
    public int month;
    public int day;

    //public boolean flg;

    //public String str;

    public MyDate() {
        this(1900,1,1);
        System.out.println("不带参数的构造方法");
    }


    public MyDate(int year,int month,int day) {
        this.year = year;
        this.day = day;
        this.month = month;
        System.out.println("带有3个参数的构造方法！");
    } //alt +  insert    快捷键可以自定义  或者直接右键 generate constructor 也行


    public MyDate(int year, int month) {
         this.year = year;
         this.month = month;
    }

    public void setDate(int y,int m,int d) {
        this.year = y;
        this.month = m;
        this.day = d;
    }

    /*public void setDate(MyDate this,int y,int m,int d) {
        this.year = y;
        this.month = m;
        this.day = d;
    }*/

    public void printDate() {
        System.out.println("year: "+this.year
        +" month: "+this.month+" day: "+this.day);
    }

    public void test() {
        System.out.println(("test()"));
    }


    //快捷键打印  右键 generate  toString()
    @Override
    public String toString() {
        return "MyDate{" +
                "year=" + year +
                ", month=" + month +
                ", day=" + day +
                '}';
    }
}
